package com.ruyuan.user.api.model.enums;

import java.util.Arrays;

/**
 * @author xx
 */
public enum UserJobRelationTypeEnum {

    MAIN_JOB(0, "主岗位"),
    VICE_JOB(1, "副岗位"),
    TMP_JOB(2, "临时岗位");

    private Integer code;

    private String description;

    UserJobRelationTypeEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static UserJobRelationTypeEnum getByCode(Integer code) {
        return Arrays.stream(UserJobRelationTypeEnum.values()).filter(relation -> relation.getCode().equals(code)).findFirst().orElse(null);
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
